import { Func, Inject, Provide } from '@midwayjs/decorator';
import { FaaSContext, FunctionHandler } from '@midwayjs/faas';
import { UserService } from './user';

@Provide()
export class IndexService implements FunctionHandler {

  @Inject()
  ctx: FaaSContext;  // context

  @Inject()
  userService: UserService

  @Func('index.handler')
  async handler() {
    return 'hello world';
  }

  @Func('index2.handler')
  async handler2() {

    let name = await this.userService.getUser();
    return `hello world ${name}`;
  }
}
